<?php

namespace App\Http\Model;

use Illuminate\Database\Eloquent\Model;
require_once 'App\Org\cate\Cate.class.php';

class Category extends Model
{
    protected $table = 'category';
    protected $primaryKey = 'cate_id';
    public $timestamps = false;
    protected $guarded=['cate_id'];
    //获取分类列表
    static public function getlist(){
        $list = self::orderBy('cate_order','asc')->get();
        $Cate = new \Cate;
        $category = $Cate::getTree($list);
        return $category;
    }
    //获取子集id
    static public function getChilds($id){
        $list = self::orderBy('cate_order','asc')->get();
        $Cate = new \Cate;
        $ids = $Cate::getChildIds($list,$id);
        return $ids;
    }
}
